package io.xxx.xbutler.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(OssProperties.class)
public class OssConfig {

    @Bean
    public OSS oss(OssProperties properties) {
        return new OSSClientBuilder()
                .build(properties.getEndpoint(), properties.getAccessKeyId(), properties.getSecretAccessKey());
    }
}
